<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page isELIgnored="false"%>
<%@ include file="../common/taglibs.jsp"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<title>POS收单运营管理平台</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<link href="<s:url value="/css/common.css"/>" type="text/css" rel="stylesheet" />
<script type="text/javascript"
	src="<c:url value="/js/jquery-1.3.2.js" />"></script>
<script type="text/javascript" src="<c:url value="/js/common.js" />"></script>
<script language="javascript" type="text/javascript"
	src="<c:url value="/js/My97DatePicker/WdatePicker.js"/>"></script>
<script type='text/javascript' src='<s:url value="/dwr/engine.js"/>'></script>
<script type='text/javascript' src='<s:url value="/dwr/interface/MccQuery.js"/>'></script>

<script type="text/javascript">

   $(document).ready(function(){
   
      loadBrandCode();
   
      $("#sub").click(function(){
         var orgCode = $("#orgCode").val();
         if(orgCode == -1){
           alert("请选择机构");
           return false;
         }
         var posBrand = $("#posBrand").val();
         if(posBrand == -1){
           alert("请选择品牌");
           return false;
         } 
         var posName = $("#posName").val();
         if(posName == -1){
           alert("请选择型号");
           return false;
         } 
         var posType = $("#posType").val();
         if(posType == -1){
           alert("请选择类型");
           return false;
         } 
         var upload=$("#upload").val();
         if(upload == ''){
           alert("请选择文件");
           return false;
         }
      });
      
		$("#downModel").click(function(){
			window.location.href="<%=basePath%>terminalYsbSnLeading/exportSNModel.ct";
		});
   });

		//加载终端名称
	function loadBrandCode() {
	
			var sortCode = $("#posBrand").val();

			if (!sortCode) {
				return;
			}
			
			MccQuery.loadYsbBrandNameByCode(sortCode, function(sortSmall) {
			    clearSelect("posName");
				fillSelect_sort("posName", sortSmall);
			});
		}
		
	function fillSelect_sort(sid, address) {
	  		
				if (!address || !sid) {
					return;
				}
				var $select = $("#" + sid);
				$select.empty();
			    $("#posName").empty().append("<option value='-1'>--请选择--</option>");
				
				
				for ( var i = 0; i < address.length; i++) {
					$select.append("<option value='"+address[i].CODE+"'>"
							+ address[i].NAME + "</option>");
				}
		}
		
	function clearSelect(sid) {
			$("#" + sid).empty().append("<option value='-1'>--请选择--</option>");
		}	
</script>



</head>

<body>
<table class="tb">
    <tbody>
		<s:form id="queryUserForm" action="/terminalYsbSnLeading/terminalYsbSnLeading.ct" method="post"
			theme="simple" enctype="multipart/form-data">
		        <tr class="tb-line">
		            <td class="tb-td" colspan="6"><div class="tb-h2">POS收单运营管理平台</div><font color="red">提示：仅支持 EXCEL-2007 版本</font></td>
		        </tr>
		
		        <tr class="tb-line">
		            <td class="tb-td" colspan="6"><div class="tb-h3">云商宝终端SN导入</div></td>
		        </tr>
				<tr class="tb-line">
					<td width="12%" style="min-width: 150px" align="right" class="tb-td">
		                <div class="tb-h4">所属机构：</div></td>
					<td class="tb-td">
                		<label class="tb-select">
							<s:select cssClass="queryWidth" name="posInfo.orgCode" 
								id="orgCode"
								list="orgList" listKey="InsIdCd" listValue="InsName" headerKey="-1" headerValue="--请选择--"/>
						</label>	
					</td>
						
					<td width="12%" style="min-width: 150px" align="right" class="tb-td">
		                <div class="tb-h4">品牌：</div></td>
					<td class="tb-td">
                		<label class="tb-select">
							<s:select cssClass="queryWidth" name="posInfo.posBrand"
								id="posBrand"
								list="#request.brandMap" listKey="key" listValue="value" onchange="loadBrandCode()" 
								 headerKey="-1" headerValue="--请选择--"/>
						</label>
					</td>
					<td width="12%" style="min-width: 150px" align="right" class="tb-td">
		                <div class="tb-h4">型号：</div></td>
					<td class="tb-td">
                		<label class="tb-select">
							<s:select cssClass="queryWidth" name="posInfo.posName"
								id="posName"
								list="#request.nameMap" listKey="key" listValue="value" 
								 headerKey="-1" headerValue="--请选择--"/>
						</label>	
					</td>
				</tr>
				<tr class="tb-line">
					<td width="12%" style="min-width: 150px" align="right" class="tb-td">
		                <div class="tb-h4">类型：</div>
		             </td>
					<td class="tb-td">
                		<label class="tb-select">
							<s:select cssClass="queryWidth" name="posInfo.posType"
								id="posType"
								list="#request.typeMap" listKey="key" listValue="value"  headerKey="-1" headerValue="--请选择--"/>
						</label>
					</td>
					<%-- 
					<td width="12%" style="min-width: 150px" align="right" class="tb-td">
		                <div class="tb-h4">资产类型：</div>
		             </td>
					<td class="tb-td">
                		<label class="tb-select">
							<s:select cssClass="queryWidth" name="posInfo.assefFlag"
								id="assefFlag"
								list="#request.assefMap" listKey="key" listValue="value"  headerKey="-1" headerValue="--请选择--"/>
						</label>
					</td> --%>
				</tr>
				<tr class="tb-line">
						<td colspan="8" align="center"><span style="font-color: red"><s:actionerror /></span>
							<span style="font-color: red;"><s:actionmessage /></span > <span style="font-color: red;"><s:fielderror
									cssClass="fieldError" /></span>
							<span id="otherError"></span>
						</td>
				</tr>
				<tr class="tb-line">
					<td colspan="8">&nbsp;<s:token></s:token></td>
				</tr>
				<tr>
					<td>
						<div class="tb-h4">请选择文件</div>
					</td>
					<td>
						<s:file id="upload" name="upload"></s:file>
					</td>
					<td>
						<s:if test=" #session.session_merchant.roleType!=\"16\" && #session.session_merchant.roleType!=\"15\" && #session.session_merchant.roleType!=\"17\"">
							<s:submit id="sub"  value="导入" />
						</s:if>
		                <input id="downModel" type="button"  value="下载模板" />
					</td>
				</tr>
		</s:form>
    </tbody>
</table>
			<!-- 
	</div> -->
	<s:if test="#request.msg !=null">
		<script language="javascript">
			alert("${request.msg}");
		</script>
	</s:if>
</body>
</html>
